/**
 * @Author:  renyc
 * @Date: 2022年12月20日16:57:37
 */

import * as Cesium from "cesium/Cesium";
import Transformer from "../../utils/Transformer";
import EntityOverlay from "./EntityOverlay";
import LayerType from "../../layer/LayerType";

class Point extends EntityOverlay{
    constructor(position, options){
        super();       
        this._position = position;
        this._options = options;
        this._delegate = undefined;
        if(position){
            let x=1;
	        let flog=true;
            this._delegate = new Cesium.Entity({
                id : this._id,
                position : Transformer.transformWGS84ToCartesian(this._position),
                point : {
                    show : true, // default
                    color :new Cesium.CallbackProperty(function (time, result) {
                        if(flog){
                            x=x-0.05;
                            if(x<=0){
                                flog=false;
                            }
                            }else{
                                x=x+0.05;
                                if(x>=1){
                                flog=true;
                                }
                            }
                            return Cesium.Color.RED.withAlpha(x);
                    },false),
                    pixelSize : 10, // default: 1
                    outlineWidth :0
                }
            });
        }


        // this._position = position;
        // if(this._position){
        //     this._delegate.position = Transformer.transformWGS84ToCartesian(this._position);
        // }
    }  
    
}

export default Point